# -*- coding:utf-8 -*- 
__date__ = '2022/6/27 8:45 下午'

'''
统计1-n之间所有的素数的个数
'''
import math


class Solution:
  def count1(self, n):
    count = 0
    for i in range(2, n):
      count += 1 if self.isPrime(i) else 0
    return count

  def isPrime(self, x):
    # for i in range(2, math.floor(math.sqrt(x))):
    i = 2
    while i ** 2 <= x:
      if x % i == 0:
        return False
      i += 1
    return True

  def count2(self, n):
    # 0为素数
    isPrimeArr = [0]*n
    count = 0
    # for i in range(2,n):




if __name__ == '__main__':
  Solution = Solution()
  count = Solution.count1(100)
  print(count)

  print(Solution.isPrime(21))
